package com.nexus.service.sys.service.mapstruct;


import com.nexus.core.service.mapstruct.BaseConverter;
import com.nexus.core.sys.dto.SysOrgMenuDTO;
import com.nexus.core.sys.dto.SysOrgUserDTO;
import com.nexus.core.sys.entity.SysOrgMenu;
import com.nexus.core.sys.entity.SysOrgUser;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

/**
 * SysOrgUserWrapper
 *
 * @author 路正宁
 * @version 2023-05-10
 */
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE, uses = {})
public interface SysOrgUserWrapper extends BaseConverter<SysOrgUser, SysOrgUserDTO> {

    SysOrgUserWrapper INSTANCE = Mappers.getMapper(SysOrgUserWrapper.class);

    @Mappings({
            @Mapping(source = "org.id", target = "org"),
            @Mapping(source = "user.id", target = "user"),
            @Mapping(source = "createBy.id", target = "createBy"),
            @Mapping(source = "updateBy.id", target = "updateBy")})
    SysOrgUser toEntity(SysOrgUserDTO dto);

    @Mappings({
            @Mapping(source = "org", target = "org.id"),
            @Mapping(source = "user", target = "user.id"),
            @Mapping(source = "createBy", target = "createBy.id"),
            @Mapping(source = "updateBy", target = "updateBy.id")})
    SysOrgUserDTO toDTO(SysOrgUser entity);
}

